# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=pingu
pkgver=1.5
pkgrel=5
pkgdesc="Small daemon that pings hosts and executes a script when status change"
url="https://github.com/ncopa/pingu"
arch="all"
license="GPL"
makedepends="libev-dev lua-dev asciidoc linux-headers"
subpackages="$pkgname-doc $pkgname-openrc lua-pingu:_lua mtu"
options="!check"
source="pingu-$pkgver.tar.gz::https://github.com/ncopa/pingu/archive/v$pkgver.tar.gz
	pingu.initd
	"

build() {
	./configure \
		--prefix=/usr \
		--localstatedir=/var \
		--sysconfdir=/etc \
		--with-luapc=lua
	make
}

package() {
	make DESTDIR="$pkgdir" install
	install -m644 -D pingu.conf "$pkgdir"/etc/pingu/pingu.conf
	install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
}

mtu() {
	pkgdesc="Utility to detect MTU"
	amove usr/bin
}

_lua() {
	pkgdesc="lua module for pingu client"
	amove usr/lib usr/share
}

sha512sums="71e5fbe93f831f24d168957cdeaff2817a22f407575316d6515755bec760d10724821070549eaab562924237b96976a1a776ca903d5fe0cd9f9b69a38eadd8c9  pingu-1.5.tar.gz
b8df9b7bec561e234a2f74514a3513ceac222477f28b9306f40aed6398f65b4e2ce84dfbbf95c0ffaedd526c4283739bf88248d699bbf7d9dac7e27e5cc5a62b  pingu.initd"
